local tool = Instance.new("Tool",owner.Backpack) tool.Name = "Ball tool" tool.ToolTip = "better than g/ball (?)" if _G.takenBallColors == nil then _G.takenBallColors = {} end local b = Instance.new("Part",tool) b.Name = "Ball" b.Shape = "Ball" b.Size = Vector3.new(6.5,6.5,6.5) b.Anchored = false b.Transparency = .7 function getunique() local n = BrickColor.Random() if _G.takenBallColors[n] ~= nil then return getunique() end _G.takenBallColors[n] = true return n end b.BrickColor = getunique() function Smooth(Part) Part.TopSurface = Enum.SurfaceType.SmoothNoOutlines Part.BottomSurface = Enum.SurfaceType.SmoothNoOutlines Part.LeftSurface = Enum.SurfaceType.SmoothNoOutlines Part.RightSurface = Enum.SurfaceType.SmoothNoOutlines Part.FrontSurface = Enum.SurfaceType.SmoothNoOutlines Part.BackSurface = Enum.SurfaceType.SmoothNoOutlines end Smooth(b) task.spawn(function() while task.wait() do pcall(function() b:SetNetworkOwner(owner) end) end end) local function Modify(Instance, Values) assert(type(Values) == "table", "Values is not a table"); for Index, Value in next, Values do if type(Index) == "number" then Value.Parent = Instance else Instance[Index] = Value end end return Instance end local function Make(ClassType, Properties) return Modify(Instance.new(ClassType), Properties) end local function WeldTogether(Part0, Part1, JointType, WeldParent) JointType = JointType or "Weld" local NewWeld = Instance.new(JointType) Modify(NewWeld, { Name = "qCFrameWeldThingy"; Part0 = Part0; Part1 = Part1; C0 = CFrame.new();--Part0.CFrame:inverse(); C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse(); Parent = Part1; }) return NewWeld end local weld tool.Equipped:Connect(function() b.CFrame = owner.Character.HumanoidRootPart.CFrame weld = WeldTogether(b,owner.Character.HumanoidRootPart) --weld.C1 = CFrame.new(0,1.5,0) end) tool.Unequipped:Connect(function() pcall(function(a) a:Destroy() end,weld) end) --_G["ballspeed"] = 5000000000 local settings = { BallFriction = 20; BallSpeed = 100; BallJumpHeight=100; BallDensity=.3; BallElasticity=.5; AllowInfiniteBallJumps=false; SparkleThreshold=8; MaxSparkleTime=6; } if _G["BallsSettings"] ~= nil and type(_G["BallsSettings"]) == "table" then for i,v in pairs(_G["BallsSettings"]) do settings[i] = v end end tool.RequiresHandle = false b.CustomPhysicalProperties=PhysicalProperties.new(settings["BallDensity"],settings["BallFriction"],settings["BallElasticity"]) local efx = Instance.new("ParticleEmitter",b) efx.Enabled = false efx.Rate = 1000 efx.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0,0); NumberSequenceKeypoint.new(0.5,1); NumberSequenceKeypoint.new(1,0); }) efx.Speed = NumberRange.new(0,0) efx.Color = ColorSequence.new(b.Color) efx.Brightness = 2 efx.Acceleration = Vector3.new(0,0,0) efx.Lifetime = NumberRange.new(1,1) local last local doing = false game:GetService("RunService").Stepped:Connect(function() local n = b.AssemblyAngularVelocity if last ~= nil and math.abs(last.Magnitude-n.Magnitude) > settings.SparkleThreshold and not doing then local ra = RaycastParams.new() ra.FilterDescendantsInstances = {tool.Parent;b} ra.FilterType = Enum.RaycastFilterType.Blacklist local ray = workspace:Raycast(b.Position,b.CFrame.p+Vector3.new(0,-5,0),ra) if ray then doing=true efx.Enabled = true task.delay((math.abs(last.Magnitude-n.Magnitude)/math.abs(last.Magnitude))*settings.MaxSparkleTime,function() if efx.Enabled then efx.Enabled = false end doing=false end) end elseif doing then doing=false end last=n end) NLS([[ local l__Parent__1 = script.Parent; local l__Character__2 = owner.Character; local v3 = l__Character__2:FindFirstChildOfClass("Humanoid"); if not v3 then while true do v3 = l__Character__2.ChildAdded:wait(); if v3.ClassName == "Humanoid" then break; end; end; end; local l__CurrentCamera__1 = workspace.CurrentCamera; local l__HumanoidRootPart__2 = l__Character__2:WaitForChild("HumanoidRootPart"); local oldc local u3 = math.rad(]]..tostring(settings.BallSpeed)..[[) local l__ball__4 = l__Parent__1.Ball l__Parent__1.Equipped:Connect(function(p1) v3.PlatformStand = true; oldc=l__CurrentCamera__1.CameraSubject l__CurrentCamera__1.CameraSubject = l__HumanoidRootPart__2 p1.KeyDown:connect(function(p2) if p2 == "w" then local u5 = false; task.spawn(function() while p1.KeyUp:wait() ~= "w" do end; u5 = true; end); while v3.PlatformStand and not u5 and task.wait() do local l__lookVector__4 = l__CurrentCamera__1.CoordinateFrame.lookVector; l__HumanoidRootPart__2.RotVelocity = l__HumanoidRootPart__2.RotVelocity + Vector3.new(l__lookVector__4.z, 0, -l__lookVector__4.x) * u3; end; return; end; if p2 == "s" then local u6 = false; task.spawn(function() while p1.KeyUp:wait() ~= "s" do end; u6 = true; end); while v3.PlatformStand and not u6 and wait(0.016666666666666666) do local l__lookVector__5 = l__CurrentCamera__1.CoordinateFrame.lookVector; l__HumanoidRootPart__2.RotVelocity = l__HumanoidRootPart__2.RotVelocity + Vector3.new(-l__lookVector__5.z, 0, l__lookVector__5.x) * u3; end; return; end; if p2 == "a" then local u7 = false; task.spawn(function() while p1.KeyUp:wait() ~= "a" do end; u7 = true; end); while v3.PlatformStand and not u7 and wait(0.016666666666666666) do local l__lookVector__6 = l__CurrentCamera__1.CoordinateFrame.lookVector; local v7 = math.atan2(l__lookVector__6.z, -l__lookVector__6.x) + math.rad(90); l__HumanoidRootPart__2.RotVelocity = l__HumanoidRootPart__2.RotVelocity + Vector3.new(math.sin(v7), 0, math.cos(v7)) * u3; end; return; end; if p2 ~= "d" then if p2 == " " then if math.abs(l__ball__4.Velocity.y) <= 10 or ]]..tostring(settings.AllowInfiniteBallJumps)..[[ then v3.PlatformStand = true; l__ball__4.Velocity = l__HumanoidRootPart__2.Velocity + Vector3.new(0, ]]..tostring(settings.BallJumpHeight)..[[, 0); end; end; return; end; local u8 = false; task.spawn(function() while p1.KeyUp:wait() ~= "d" do end; u8 = true; end); while v3.PlatformStand and not u8 and wait(0.016666666666666666) do local l__lookVector__8 = l__CurrentCamera__1.CoordinateFrame.lookVector; local v9 = math.atan2(l__lookVector__8.z, -l__lookVector__8.x) - math.rad(90); l__HumanoidRootPart__2.RotVelocity = l__HumanoidRootPart__2.RotVelocity + Vector3.new(math.sin(v9), 0, math.cos(v9)) * u3; end; end); end); l__Parent__1.Unequipped:Connect(function() v3.PlatformStand = false; if oldc ~= nil then l__CurrentCamera__1.CameraSubject = oldc end end); ]],tool)